//
//  BusinessViewController.m
//  PaiLeXiongProject
//
//  Created by 小獾科技 on 2017/9/8.
//  Copyright © 2017年 小獾科技. All rights reserved.
//

#import "BusinessViewController.h"
#import "BusinessCell.h"
@interface BusinessViewController ()<UITableViewDelegate, UITableViewDataSource>

@end

@implementation BusinessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    [self addBackItem];
//    self.title = @"商务合作";
//    [self configNavigation:@"商务合作"];
    self.title = @"商务合作";
    [self addBackItem];
    UITableView *tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, GWIDTH, 162) style:UITableViewStylePlain];
    tableview.delegate = self;
    tableview.dataSource = self;
    tableview.rowHeight = 54;
    tableview.scrollEnabled = NO;
    [self.view addSubview:tableview];
    tableview.separatorColor = ColorClear;
    [tableview registerClass:[BusinessCell class] forCellReuseIdentifier:@"cell"];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    BusinessCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if(indexPath.row == 0)
        cell.label.text = @"电话：156 6360 0116";
    else if (indexPath.row == 1)
        cell.label.text = @"邮箱：394410@qq.com";
    else
        cell.label.text = @"联系人：周宇";
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.row == 0)
    {
        AlertViewManager *alertView = [[AlertViewManager alloc] initWithTitle:[NSString stringWithFormat:@"拨打156 6360 0116"] message:@"派乐熊将为您提供更安心的服务" cancelButtonTitle:@"我再逛逛" confirmButtonTitle:@"联系客服" delegate:[UIApplication sharedApplication].keyWindow block:^(NSInteger idx) {
            
            if (idx == 1) {
                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:15663600116"]]];
            }
        }];
        [alertView show];
    }
    else
    {
        return;
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
